import {SHOW_ALERT, CLOSE_ALERT} from '../constants'
import {MSGAction} from '../actions'
import  {StoreState} from '../types'

const reducers = (state: StoreState, action: MSGAction): StoreState =>  {
    switch (action.type) {
        case SHOW_ALERT:
            return {
                alertState: true,
                msg: action.msg
            };
        case CLOSE_ALERT:
            return {
                alertState: false,
                msg: ""
            };
        default:
            return state;
    }
}

export default reducers;

